﻿namespace UnityEditorInternal
{
    using System;
    using System.Runtime.CompilerServices;
    using UnityEditor;
    using UnityEngine;

    public sealed class Transition : UnityEngine.Object
    {
        private static readonly GUIContent s_TransitionTempContent = new GUIContent();

        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern void AddCondition();
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern bool GetAtomic();
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern int GetConditionCount();
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern string GetConditionEvent(int index);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern TransitionConditionMode GetConditionMode(int index);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern string GetDisplayName(bool shortName);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern UnityEditorInternal.State GetDstState();
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern float GetEventTreshold(int index);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern float GetExitTime(int index);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern bool GetMute();
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern string GetName();
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern bool GetSolo();
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern UnityEditorInternal.State GetSrcState();
        public GUIContent GetTransitionContentForRect(Rect rect)
        {
            s_TransitionTempContent.text = this.GetDisplayName(false);
            if (EditorStyles.label.CalcSize(s_TransitionTempContent).x > rect.width)
            {
                s_TransitionTempContent.text = this.GetDisplayName(true);
            }
            return s_TransitionTempContent;
        }

        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern float GetTransitionDuration();
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern float GetTransitionOffset();
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern string GetUniqueName();
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern int GetUniqueNameHash();
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern void RemoveCondition(int index);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern void SetAtomic(bool val);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern void SetConditionEvent(int index, string eventName);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern void SetConditionMode(int index, TransitionConditionMode mode);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern void SetEventTreshold(int index, float threshold);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern void SetExitTime(int index, float exit);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern void SetMute(bool val);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern void SetName(string name);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern void SetSolo(bool val);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern void SetTransitionDuration(float duration);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern void SetTransitionOffset(float offset);
    }
}

